GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Wizard.constructor   B
last analyzed

Complexity

Conditions 8

Size

Total Lines 57
Code Lines 37

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 37
dl 0
loc 57
rs 7.1253
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/**
2
 * This file is part of the O2System Venus UI Framework package.
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @author         Steeve Andrian Salim
8
 * @copyright      Copyright (c) Steeve Andrian Salim
9
 */
10
// ------------------------------------------------------------------------
11
12
import * as $ from 'jquery';
13
import 'jquery-steps/build/jquery.steps.js';
14
import 'jquery-validation';
15
import Swal from 'sweetalert2';
16
/**
17
 * Class Wizard
18
 *
19
 * @author          Teguh Rianto
20
 * @package         Components
21
 */
22
23
export default class Wizard {
24
    constructor() {
25
        //WIZARD
26
        $(".tab-wizard").steps({
27
            headerTag: "h6",
28
            bodyTag: "section",
29
            transitionEffect: "fade",
30
            titleTemplate: '<span class="step">#index#</span> #title#',
31
            labels: {
32
                finish: "Submit"
33
            },
34
            onFinished: function (event, currentIndex) {
0 ignored issues
show
Unused Code introduced by
The parameter currentIndex is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter event is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
35
                Swal("Form Submitted!", "Success");
36
37
            }
38
        });
39
40
41
        var form = $(".validation-wizard").show();
42
43
        $(".validation-wizard").steps({
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
44
            headerTag: "h6",
45
            bodyTag: "section",
46
            transitionEffect: "fade",
47
            titleTemplate: '<span class="step">#index#</span> #title#',
48
            labels: {
49
                finish: "Submit"
50
            },
51
            onStepChanging: function (event, currentIndex, newIndex) {
52
                return currentIndex > newIndex || !(3 === newIndex && Number($("#age-2").val()) < 18) && (currentIndex < newIndex && (form.find(".body:eq(" + newIndex + ") label.error").remove(), form.find(".body:eq(" + newIndex + ") .error").removeClass("error")), form.validate().settings.ignore = ":disabled,:hidden", form.valid())
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
53
            },
54
            onFinishing: function (event, currentIndex) {
0 ignored issues
show
Unused Code introduced by
The parameter event is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter currentIndex is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
55
                return form.validate().settings.ignore = ":disabled", form.valid()
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
56
            },
57
            onFinished: function (event, currentIndex) {
0 ignored issues
show
Unused Code introduced by
The parameter currentIndex is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter event is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
58
                Swal("Form Submitted!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed.");
59
            }
60
        }),
61
        $(".validation-wizard").validate({
62
            ignore: "input[type=hidden]",
63
            errorClass: "text-danger",
64
            successClass: "text-success",
65
            highlight: function (element, errorClass) {
66
                $(element).removeClass(errorClass)
67
            },
68
            unhighlight: function (element, errorClass) {
69
                $(element).removeClass(errorClass)
70
            },
71
            errorPlacement: function (error, element) {
72
                error.insertAfter(element)
73
            },
74
            rules: {
75
                email: {
76
                    email: !0
77
                }
78
            }
79
        });
80
    }
81
}